// 使用带缓冲区的输入输出流来进行大容量数据传输
try (BufferedInputStream bis = new BufferedInputStream(new FileInputStream("source.dat"));
     BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("target.dat"))) {
    byte[] buffer = new byte[8192]; // 定义适当大小的缓冲区
    int bytesRead;
    while ((bytesRead = bis.read(buffer)) != -1) {
        bos.write(buffer, 0, bytesRead);
    }
} catch (IOException e) {
    e.printStackTrace();
}
